const moment = require('moment');
exports.getRemoteIp = req => (req.headers['x-forwarded-for'] || '').split(',')[0] || req.connection.remoteAddress;

exports.formatDate = (date) => {
    if (!date) {
        return '';
    }
    return moment(date).format('YYYY-MM-DD HH:mm:ss');
};

exports.formatHHMM = (date) => {
    if (!date) {
        return '';
    }
    return moment(date).format('MM-DD HH:mm');
}

exports.dealNumberTwo = function (number) {
  return Math.floor(number * 100)/ 100
};
